<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>Main and child scripts</title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>

<body>

<div align="center">
<table class=allEncompassingTable >
 <tr>
  <td >
<p><a href="../index.html" TARGET="_top"><img src="images/homeImg.png"></a></p>



<h1>The main and child scripts</h1>

<p>The <a href="mainScript.htm">main script</a> and the <a href="childScripts.htm">child scripts</a>, which are <a href="simulationScripts.htm">simulation scripts</a>, play the central role in each simulation: while the main script contains the simulation loop code, child scripts contain the typical code to control <a href="models.htm">models</a> (e.g. robots, sensors or actuators). </p>
<p>By default, each <a href="scenes.htm">scene</a> has a main script that handles all the functionality. Without main script, a <a href="simulation.htm">simulation</a> cannot run. The main script can be customized, but it is preferable to do all the customization work in a child script.</p>

<p>Each <a href="objects.htm">scene object</a> can be associated with a child script that will handle a specific part of a simulation, in an independent and distributed fashion. The most common use for child scripts is to have them control a model.</p>


<p>Following are the main differences between the main script and a child script:</p>

<li>there can only be one main script. There can be an unlimited number of child scripts.</li>

<li>the main script is independent and should preferably not be customized. Child scripts are associated with scene objects and should be customized.</li>

<li>the main script is never duplicated in a copy/paste operation of scene objects. Child scripts will duplicate themselves together with their associated scene object.</li>

<li>the main script cannot be threaded. Child scripts can be <a href="childScripts.htm#threaded">threaded</a> or <a href="childScripts.htm#nonThreaded">non-threaded</a>.</li>

<li>child scripts can use special types of system <a href="callbackFunctions.htm">callback functions</a>.</li>

<br>
<br>
<h3 class=recommendedTopics>Recommended topics</h3>
<li><a href="mainScript.htm">The main script</a></li>
<li><a href="childScripts.htm">Child scripts</a></li>
<li><a href="callbackFunctions.htm">Callback functions</a></li>
<br>
<br>
 </tr>
</table> 
</div>  
  
  
</body>

</html>
